<?php //        
$result = $dbfunc->query("SELECT *,tb_sec.* FROM tb_student 
        LEFT JOIN tb_reg ON tb_student.student_id = tb_reg.student_id 
        NATURAL JOIN tb_sec NATURAL JOIN tb_subject 
        WHERE tb_student.student_id='{$_SESSION['sess_userid']}'
        
        UNION
        
        SELECT *,tb_sec.* FROM tb_student 
        LEFT JOIN tb_plan ON tb_student.room_id = tb_plan.room_id
        NATURAL JOIN tb_sec NATURAL JOIN tb_subject 
        WHERE tb_student.student_id='{$_SESSION['sess_userid']}'
        "
        );
?>

<div align="center">
    <div>คลิกที่ชั้นเรียนเพื่อตรวจสอบงาน</div>
    <table border="1">
        <tr>
            <td>ชั้นเรียน</td>
        </tr>
        <?php
        while($item = mysql_fetch_assoc($result)){            
            echo "<tr>";
            echo "<td><a href=\"index.php?module=student&page=job_feed&sec_id={$item['sec_id']}\">".$item['subject_name']."(".$item['sec_des'].")</a></td>";
            echo "</tr>";
        }
        ?>
    </table>
</div>